<!--
*@Author: zt
*@Description: 新增文件详情
*@Date: 2024-08-20
-->
<template>
  <u-dialog v-bind="$attrs" @close="dialogClose" @submit='submit()'>
    <a-layout class="f-h-100">
      <a-layout-content class="s-bg-white" style="overflow: auto">
        <a-space direction="vertical" class="f-w-100">
          <u-busi-card title="基本信息" :bordered="false">
            <u-field-upload v-model:value="fileData" :fileParams="{
              bucket: 'DOC_BIZ_TYPE_DOCUMENT',
              biztype: '2',
            }"></u-field-upload>
          </u-busi-card>
        </a-space>
      </a-layout-content>
    </a-layout>
  </u-dialog>
</template>

<script lang='ts' setup>
import { ref, reactive, computed, onMounted, h, useAttrs, watch } from 'vue'
import * as docApi from "@/service/assist/doc";
import { useRoute, useRouter } from 'vue-router'
import { _IFormEl, _IExtra } from '@/src/components/common/form/interface';
import { FormInstance, FormItemProps, message, } from 'ant-design-vue';
import type { UploadChangeParam } from 'ant-design-vue'
import { HomeOutlined, FileTextOutlined, UploadOutlined } from '@ant-design/icons-vue';
import { TreeProps } from 'ant-design-vue/es/vc-tree';
import { ColumnProps } from 'ant-design-vue/es/table';
import { _IColumnProps } from '@/components/common/tableEdit/interface.ts'
import { fileCols } from '@/common/model/fileCols'
import { isSel } from '@/common/model/base'
import { alertC } from '@/util/common';
const attrs = useAttrs();
const route = useRoute()
const emit = defineEmits(['success'])
const formRef = ref<FormInstance>()
// const showUpload = ref(false)

const showUpload = ref(false)



const fileData = ref()


// 弹窗关闭
const dialogClose = () => {
  // formRef.value.form.resetFields();
}

const submit = async () => {
  if (fileData.value.length < 1) {
    return alertC('请选择文件上传')
  }

  fileData.value.map(e => {
    e['filename'] = e['name']
  })
  const res = await docApi.addEdit({ appendixSaveVOList: fileData.value, fkfloderid: attrs.fkfloderid })
  if (res.code == 0) {
    message.success('操作成功')
    showUpload.value = false
    fileData.value = []
    emit('success')
  }

}

watch(() => attrs.open, () => {
  fileData.value = []
})
</script>

<style lang='scss'></style>